import 'package:flutter_module/data/dispatcher/ni_data_element_dispacther.dart';
import 'package:flutter_module/data/dispatcher/ni_data_layer_dispacther.dart';
import 'package:flutter_module/data/dispatcher/ni_data_project_dispacther.dart';

class NIDataDispatcherFactory {
  // 工厂模式
  factory NIDataDispatcherFactory() => _getInstance();

  static NIDataDispatcherFactory get instance => _getInstance();
  static final NIDataDispatcherFactory _instance =
      NIDataDispatcherFactory._internal();

  late NIDataLayerDispatcher _dataLayerDispatcher;
  late NIDataElementDispatcher _dataElementDispatcher;
  late NIDataProjectDispatcher _dataProjectDispatcher;

  NIDataDispatcherFactory._internal() {
    _dataLayerDispatcher = NIDataLayerDispatcher();
    _dataElementDispatcher = NIDataElementDispatcher();
    _dataProjectDispatcher = NIDataProjectDispatcher();
  }

  static NIDataDispatcherFactory _getInstance() {
    return _instance;
  }

  ///数据图层控制
  NIDataLayerDispatcher get dataLayerDispatcher => _dataLayerDispatcher;

  ///数据控制
  NIDataElementDispatcher get dataElementDispatcher => _dataElementDispatcher;

  ///项目控制
  NIDataProjectDispatcher get dataProjectDispatcher => _dataProjectDispatcher;
}
